﻿<%@ Page Title="" Language="C#" MasterPageFile="~/Page/Site.Master" AutoEventWireup="true" CodeBehind="danh-muc-kho.aspx.cs" EnableEventValidation="false" Inherits="VanTaiTMS.Page.danh_muc_kho" %>
<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="server">
<!---Check-all----->
<script type="text/javascript">
    function checkAll() {
        $('.bordered tbody tr').each(function () {
            if ($('input#chkAll').is(":checked")) {
                $('input#chkList').attr({ 'checked': 'checked' });
                $('input#chkList').parent().parent().css({ 'background': 'rgb(208, 233, 198)' });
            } else {
                $('input#chkList').attr({ 'checked': false });
                $('input#chkList').parent().parent().css({ 'background': '' });
            }
        });
    }
</script>
<!-------End------->
<!---AutoComplete-->
<script type="text/javascript">
    function pageLoad() {
        //Check Row Hender Color
        $(document).ready(function () {
            $('.bordered tbody tr').click(function (event) {
                if (event.target.type !== 'checkbox') {
                    $(':checkbox', this).trigger('click');
                }
            });

            $("input[type='checkbox']").change(function (e) {
                if ($(this).is(":checked")) {
                    $(this).closest('tr').css("background", "rgb(208, 233, 198)");
                } else {
                    $(this).closest('tr').css("background", "");
                }
            });
        });
    }
</script>
<!-------End------->
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" runat="server">
<asp:UpdatePanel ID="upDateToolBar" runat="server">
    <ContentTemplate>
        <div id="toolbar-1" class="yui3-toolbar">
            <div class="div-search_A">
            <asp:Button ID="cmdEdit" runat="server" CssClass="btn-add-edit"  Text="" onclick="cmdEdit_Click" />
            </div>
            <div class="div-search-texbox">
            <asp:TextBox ID="txtSearch" placeholder="Nhập vào từ khoá tìm kiếm..." CssClass="textbox_child_Search" runat="server"></asp:TextBox>
            </div>
            <div class="div-search">
            <asp:Button ID="cmdSerach" runat="server" CssClass="btn-add-search" Text="" OnClick="cmdSerach_Click" />
            <asp:Button ID="cmdRefesh" runat="server" CssClass="btn-add-refesh"  Text="" onclick="cmdRefesh_Click" />
           
            <input type="button" title="Xuất ra tập tin Excel" onclick="tableToExcel('testTable', 'W3C Example Table')" class="btn-add-excel" />
           </div>
        <div class="clr"></div>
        </div>     
        <div class="clr"></div>
    </ContentTemplate>
</asp:UpdatePanel>

<asp:UpdatePanel ID="upDatePanelAll" runat="server">
<ContentTemplate>
     <%=StrAlert%>
    <!-----------Hiễn-Thị-Dữ-Liệu------------>
    <table  class="bordered" id="testTable">
        <thead>
            <tr>
                <th width="5%">STT</th>        
                <th width="5%">
                    <input type="checkbox" onclick="checkAll('chkList');" id="chkAll">
                </th>
                <th width="10%">Mã kho_01</th>
                <th width="10%">Mã kho_02</th>
                <th width="10%">Tên kho</th>
                <th width="10%">Kích thước</th>
                <th width="10%">Từ khoá</th>
                <th width="10%">Đơn vị tính</th>
                <th width="10%">Nhóm kho</th>
                <th width="10%">Trọng lượng</th>
                <th width="10%">Ghi chú</th>
            </tr>
        </thead>

        <tbody>
             <asp:ListView ID="ListViewAll" runat="server" ItemPlaceholderID="lstViewAll" DataKeyNames="STT" OnItemCommand="ListViewAll_ItemCommand" OnItemDataBound="ListViewAll_ItemDataBound">
                <ItemTemplate>
                    <tr>
                        <td align="center" style="text-align:center">
                            <asp:Label ID="lb_lst_ID" runat="server" Text='<%# Eval("STT") %>'></asp:Label>
                        </td>

                        <td style="text-align:center">
                            <asp:CheckBox ID="chkList" ClientIDMode="Static" runat="server" />
                        </td>

                        <td style="text-align:center">
                            <asp:LinkButton ID="linkListName_G" CommandName="Accept" runat="server"><%# Eval("No_")%></asp:LinkButton>
                        </td>

                        <td style="text-align:center">
                            <asp:LinkButton ID="linkListName_F" CommandName="Accept" runat="server"><%# Eval("No_2")%></asp:LinkButton>
                            <input type="hidden" id="hiddenId" value='<%# Eval("STT") %>' runat="server" name="hiddenId" />
                        </td>

                        <td style="text-align:center">
                            <asp:LinkButton ID="linkListName" CommandName="Accept" runat="server" Text='<%# Eval("Name")%>'></asp:LinkButton>
                        </td>

                        <td style="text-align:center">
                            <asp:LinkButton ID="linkSize" CommandName="Accept" runat="server"><%# Eval("Size")%></asp:LinkButton>
                        </td>

                        <td style="text-align:center">
                            <asp:LinkButton ID="linkSearchName" CommandName="Accept" runat="server"><%# Eval("SearchName")%></asp:LinkButton>
                        </td>

                        <td style="text-align:center">
                            <asp:LinkButton ID="linkUnit" CommandName="Accept" runat="server"><%# Eval("Unit")%></asp:LinkButton>
                        </td>

                        <td style="text-align:center">
                            <asp:LinkButton ID="linkGroupItem" CommandName="Accept" runat="server" Text='<%# Eval("Name_G")%>'></asp:LinkButton>
                        </td>

                        <td style="text-align:center">
                            <asp:LinkButton ID="linkNetWeight" CommandName="Accept" runat="server" Text='<%# Eval("NetWeight")%>'></asp:LinkButton>
                        </td>

                        <td style="text-align:center">
                            <asp:LinkButton ID="linkNote" CommandName="Accept" runat="server" Text='<%# Eval("Description")%>'></asp:LinkButton>
                        </td>
                    </tr>
                </ItemTemplate>
                <LayoutTemplate>
                    <asp:PlaceHolder runat="server" ID="lstViewAll"></asp:PlaceHolder>
                </LayoutTemplate>
             </asp:ListView>
        </tbody>
    </table>
    <!--------------Kêt-thúc----------------->

    <!-------------Phân-trang---------------->
    <table  class="bordered">
        <thead>
            <tr>
                <th class="pager">
                    <asp:DataPager ID="DataPagerListAll" runat="server" 
                        OnPreRender="DataPagerListAll_PreRender" PagedControlID="ListViewAll">
                        <Fields>
                            <asp:NextPreviousPagerField FirstPageText="&lt;&lt;" PreviousPageText="&lt;" 
                                ShowFirstPageButton="True" ShowNextPageButton="False" />
                            <asp:NumericPagerField />
                            <asp:NextPreviousPagerField LastPageText="&gt;&gt;" NextPageText="&gt;" 
                                ShowLastPageButton="True" ShowPreviousPageButton="False" />
                        </Fields>
                    </asp:DataPager>
                </th>
            </tr>
        </thead>
    </table>
    <!--------------Kêt-thúc----------------->
</ContentTemplate>
</asp:UpdatePanel>
</asp:Content>
